﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class TFBuffer
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class TFBuffer
   ">
    <meta name="generator" content="docfx 2.18.2.0">
    
    <link rel="shortcut icon" href="../../favicon.ico">
    <link rel="stylesheet" href="../../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../../styles/docfx.css">
    <link rel="stylesheet" href="../../styles/main.css">
    <meta property="docfx:navrel" content="../../toc.html">
    <meta property="docfx:tocrel" content="../toc.html">
    
    
  </head>
  <body data-spy="scroll" data-target="#affix">
    <div id="wrapper">
      <header>
        
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              
              <a class="navbar-brand" href="../../index.html">
                <img id="logo" class="svg" src="../../logo.svg" alt="">
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div role="main" class="container body-content hide-when-search">
        
        <div class="sidenav hide-when-search">
          <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
          <div class="sidetoggle collapse" id="sidetoggle">
            <div id="sidetoc"></div>
          </div>
        </div>
        <div class="article row grid-right">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="TensorFlow.TFBuffer">
  
  
  <h1 id="TensorFlow_TFBuffer" data-uid="TensorFlow.TFBuffer">Class TFBuffer
  </h1>
  <div class="markdown level0 summary"><p>Holds a block of data, suitable to pass, or retrieve from TensorFlow.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><span class="xref">System.Object</span></div>
    <div class="level1"><a class="xref" href="TensorFlow.TFDisposable.html">TFDisposable</a></div>
    <div class="level2"><span class="xref">TFBuffer</span></div>
  </div>
  <div class="inheritedMembers">
    <h5>Inherited Members</h5>
    <div>
      <a class="xref" href="TensorFlow.TFDisposable.html#TensorFlow_TFDisposable_Dispose">TFDisposable.Dispose()</a>
    </div>
    <div>
      <a class="xref" href="TensorFlow.TFDisposable.html#TensorFlow_TFDisposable_Dispose_System_Boolean_">TFDisposable.Dispose(Boolean)</a>
    </div>
    <div>
      <a class="xref" href="TensorFlow.TFDisposable.html#TensorFlow_TFDisposable_Handle">TFDisposable.Handle</a>
    </div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="../TensorFlow.html">TensorFlow</a></h6>
  <h6><strong>Assembly</strong>: TensorFlowSharp.dll</h6>
  <h5 id="TensorFlow_TFBuffer_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class TFBuffer : TensorFlow.TFDisposable</code></pre>
  </div>
  <h5 id="TensorFlow_TFBuffer_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>
            Use the TFBuffer to blobs of data into TensorFlow, or to retrieve blocks
            of data out of TensorFlow.
            </p>
    <p>
            There are two constructors to wrap existing data, one to wrap blocks that are 
            pointed to by an IntPtr and one that takes a byte array that we want to wrap.
            </p>
    <p>
            The empty constructor can be used to create a new TFBuffer that can be populated
            by the TensorFlow library and returned to user code.
            </p>
    <p>
            Typically, the data consists of a serialized protocol buffer, but other data
            may also be held in a buffer.
            </p></div>
  <h3 id="constructors">Constructors
  </h3>
  
  
  <a id="TensorFlow_TFBuffer__ctor_" data-uid="TensorFlow.TFBuffer.#ctor*"></a>
  <h4 id="TensorFlow_TFBuffer__ctor" data-uid="TensorFlow.TFBuffer.#ctor">TFBuffer()</h4>
  <div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="TensorFlow.TFBuffer.html">TFBuffer</a> class.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TFBuffer ();</code></pre>
  </div>
  
  
  <a id="TensorFlow_TFBuffer__ctor_" data-uid="TensorFlow.TFBuffer.#ctor*"></a>
  <h4 id="TensorFlow_TFBuffer__ctor_System_Byte___" data-uid="TensorFlow.TFBuffer.#ctor(System.Byte[])">TFBuffer(Byte[])</h4>
  <div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="TensorFlow.TFBuffer.html">TFBuffer</a> by making a copy of the provided byte array.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TFBuffer (byte[] buffer);</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Byte</span>[]</td>
        <td><span class="parametername">buffer</span></td>
        <td><p>Buffer of data that will be wrapped.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="TensorFlow_TFBuffer__ctor_System_Byte____remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This constructor makes a copy of the data into an unmanaged buffer, 
            so the byte array is not pinned.</p>
</div>
  
  
  <a id="TensorFlow_TFBuffer__ctor_" data-uid="TensorFlow.TFBuffer.#ctor*"></a>
  <h4 id="TensorFlow_TFBuffer__ctor_System_Byte___System_Int32_System_Int32_" data-uid="TensorFlow.TFBuffer.#ctor(System.Byte[],System.Int32,System.Int32)">TFBuffer(Byte[], Int32, Int32)</h4>
  <div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="TensorFlow.TFBuffer.html">TFBuffer</a> by making a copy of the provided byte array.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TFBuffer (byte[] buffer, int start, int count);</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Byte</span>[]</td>
        <td><span class="parametername">buffer</span></td>
        <td><p>Buffer of data that will be wrapped.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><span class="parametername">start</span></td>
        <td><p>Starting offset into the buffer to wrap.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><span class="parametername">count</span></td>
        <td><p>Number of bytes from the buffer to keep.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="TensorFlow_TFBuffer__ctor_System_Byte___System_Int32_System_Int32__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This constructor makes a copy of the data into an unmanaged buffer, 
            so the byte array is not pinned.</p>
</div>
  
  
  <a id="TensorFlow_TFBuffer__ctor_" data-uid="TensorFlow.TFBuffer.#ctor*"></a>
  <h4 id="TensorFlow_TFBuffer__ctor_System_IntPtr_System_Int64_TensorFlow_TFBuffer_BufferReleaseFunc_" data-uid="TensorFlow.TFBuffer.#ctor(System.IntPtr,System.Int64,TensorFlow.TFBuffer.BufferReleaseFunc)">TFBuffer(IntPtr, Int64, TFBuffer+BufferReleaseFunc)</h4>
  <div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="TensorFlow.TFBuffer.html">TFBuffer</a> by wrapping the unmanaged resource pointed by the buffer.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TFBuffer (IntPtr buffer, long size, TensorFlow.TFBuffer.BufferReleaseFunc release);</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.IntPtr</span></td>
        <td><span class="parametername">buffer</span></td>
        <td><p>Pointer to the data that will be wrapped.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Int64</span></td>
        <td><span class="parametername">size</span></td>
        <td><p>The size of the buffer to wrap.</p>
</td>
      </tr>
      <tr>
        <td></td>
        <td><span class="parametername">release</span></td>
        <td><p>Optional, if not null, this method will be invoked to release the block.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="TensorFlow_TFBuffer__ctor_System_IntPtr_System_Int64_TensorFlow_TFBuffer_BufferReleaseFunc__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This constructor wraps the buffer as a the data to be held by the <a class="xref" href="TensorFlow.TFBuffer.html">TFBuffer</a>,
            if the release parameter is null, then you must ensure that the data is not released before the TFBuffer
            is no longer in use.   If the value is not null, the provided method will be invoked to release
            the data when the TFBuffer is disposed, or the contents of the buffer replaced.</p>
</div>
  <h3 id="methods">Methods
  </h3>
  
  
  <a id="TensorFlow_TFBuffer_ToArray_" data-uid="TensorFlow.TFBuffer.ToArray*"></a>
  <h4 id="TensorFlow_TFBuffer_ToArray" data-uid="TensorFlow.TFBuffer.ToArray">ToArray()</h4>
  <div class="markdown level1 summary"><p>Returns a byte array representing the data wrapped by this buffer.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public byte[] ToArray ();</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Byte</span>[]</td>
        <td><p>The array.</p>
</td>
      </tr>
    </tbody>
  </table>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
              <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
              </nav>
            </div>
          </div>
        </div>
      </div>
      
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            
            <span>Copyright © 2015-2017 Microsoft<br>Generated by <strong>DocFX</strong></span>
          </div>
        </div>
      </footer>
    </div>
    
    <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="../../styles/docfx.js"></script>
    <script type="text/javascript" src="../../styles/main.js"></script>
  </body>
</html>
